/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Lenovo
 * Date: 2025-03-21
 * Time: 19:12
 */
class Animal {
   public String name;


    public Animal(String name) {
        this.name = name;
        System.out.println("Animal有参构造方法!!!");
    }
}
//Mammal是哺乳动物
class Mammal extends Animal {
    public Mammal(String name) {
        super(name);//显式调用父类Animal的有参构造方法
        System.out.println("Mammal的有参构造方法！！！");
    }
}

class Dog extends Mammal {
    public Dog(String name) {
        super(name);// 调用父类Mammal的构造方法
        System.out.println("Dog的构造方法！！！");
    }
}

